Skip to content

Add /count command - #3446

Merged
IntegratedQuantum merged 7 commits into
PixelGuys:masterfrom
Argmaster:count-command
Aug 11, 2026
Merged

IntegratedQuantum merged 7 commits into
PixelGuys:masterfrom
Argmaster:count-command

Conversation

@Argmaster

Copy link
Copy Markdown
Collaborator

Adds trivial /count command implementation.

image

Currently based on hash map, when we swap to palette storage for blueprints (#1896) we can reduce it to just printing palette entries.
It could be useful to get also entity counts and differentiate blocks with different data values, all out of scope, material for future improvements.

Resolves: #3043

@Argmaster Argmaster changed the title Add /count command Add /count command Jul 31, 2026
@Wunka

Wunka commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Its still a draft, but would it maybe make sense to give it an optional value to say for which block you want to know the count?

@Argmaster

Argmaster commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Yeah its doable, tho since this is primarily aimed at humans, I think its rare they will be looking for very specific block and they will care to write down the Id.

@Argmaster Argmaster mentioned this pull request Jul 31, 2026
@Argmaster
Argmaster marked this pull request as ready for review July 31, 2026 18:28
@Argmaster Argmaster moved this to Low Priority in PRs to review Aug 7, 2026

@IntegratedQuantum IntegratedQuantum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very useful, thanks for implementing

Comment thread src/server/command/worldedit/count.zig Outdated
Comment thread src/server/command/worldedit/count.zig Outdated
} else {
var iterator = context.iterator();
while (iterator.next()) |next| {
user.sendMessage("#ffff00{s} #ffffff{d}", .{(Block{.typ = next.key_ptr.*, .data = 0}).id(), next.value_ptr.*});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you print them sorted by count, descending?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

I also added padding on count and swapped ids with count, since ids tend to get quite long

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that looks so much nicer!

@IntegratedQuantum IntegratedQuantum moved this from Low Priority to In review in PRs to review Aug 8, 2026
Argmaster and others added 3 commits August 8, 2026 15:26
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
Comment thread src/server/command/worldedit/count.zig
Comment thread src/server/command/worldedit/count.zig Outdated
Argmaster and others added 2 commits August 9, 2026 13:49
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
@IntegratedQuantum
IntegratedQuantum merged commit d58faed into PixelGuys:master Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

/count command (worldedit)

3 participants